<?php 
	class ViewModel{
		private $data= array();
		private $view = FALSE;

		//完成对视图的初始化
		public function __Construct($template){
			//构成完整文件路径
			$file ='Home/View/'.strtolower($template).'.php';
			if(file_exists($file)){
				$this->view = $file;
				
			}
			else
				echo "文件不存在";	
		}

		public function assign($var,$value){
			$this->data[$var]=$value;
		}
		
		//显示视图
		public function display(){
			$data = $this->data;
			include($this->view);
			
		}
	}

?>